package composite_pattern;

import composite_pattern.abstract_file.file.Folder;
import composite_pattern.abstract_file.file.ImageFile;
import composite_pattern.abstract_file.file.TextFile;
import composite_pattern.abstract_file.file.VideoFile;

public class Client {
    public static void main(String[] args) {
        Folder folder = new Folder("一级文件夹");
        Folder folder1 = new Folder("二级文件夹");
        folder.add(folder1);
        TextFile textFile = new TextFile("文本文件2");
        folder.add(new TextFile("文本文件"));
        folder.add(textFile);
        folder.add(new ImageFile("图像文件"));
        folder.add(new VideoFile("视频文件"));
        folder.getChild();
        System.out.println("---------------------分割线---------------");
        System.out.print(folder.getName() + ":");
        folder.display();
        System.out.println("---------------------分割线---------------");
        folder1.add(new TextFile("又一个文本文件"));
        folder1.add(new ImageFile("又一个图像文件"));
        folder1.add(new VideoFile("又一个视频文件"));
        System.out.print(textFile.getName() + ":");
        folder.remove(textFile);
        textFile.display();
        System.out.println("---------------------分割线---------------");
        folder.getChild();
        System.out.println("---------------------分割线---------------");
        folder1.getChild();
    }
}
